﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

using University.Workshop.Model;
using University.Workshop.DataAccess;

//[assembly: CLSCompliant(true)]
namespace University.Workshop.Business
{
    public static class ConsultationManager
    {
        public static Consultation RegisterNewConsultation(
            string patientId,
            string doctorId,
            int appointmentId,

            string familyHistory,
            string familyHistoryDetails,

            string pastMedicalHistory,
            string pastMedicalHistoryDetails,

            string personalHistory,
            string personalHistoryDetails,

            string heartRate,
            string bloodPressure,
            string respirationRate,
            string temperature,
            string currentWeight,
            string height,
            string idealWeight,

            string chiefComplaints,
            string generalSymptoms,

            string currentCondition,
            string currentConditionDetails,
            string previousDiagnoses,
            string previouslyEmployedTherapeutic,

            string digestiveApparatus,
            string cardiovascularApparatus,
            string respiratoryApparatus,
            string urinaryApparatus,
            string genitalApparatus,
            string hematologicApparatus,
            string endocrineSystem,
            string musculoskeletalSystem, /*Osteomuscular*/
            string nervousSystem,
            string sensorialSystem,
            string psychosomatic,

            string generalExamination,
            string examinationHead,
            string examinationNeck,
            string examinationChest,
            string examinationAbdomen,
            string examinationMembers,
            string examinationGenitals,


            /*string AppointmentId,
            string ConsultationDate,
            string ConsultationStatus,
            string ChiefComplaints,
            string GeneralSymptoms,*/

            string comments,
            string diagnosis,
            string prognosis,
            string treatment)

        {
            /*if (string.IsNullOrEmpty(FamilyHistory)
                
                /*string.IsNullOrEmpty(AppointmentId) ||
                string.IsNullOrEmpty(ConsultationDate) ||
                string.IsNullOrEmpty(ConsultationStatus) ||
                string.IsNullOrEmpty(ChiefComplaints) ||
                string.IsNullOrEmpty(GeneralSymptoms) ||*/



            /*string.IsNullOrEmpty(Comments) ||
            string.IsNullOrEmpty(Diagnosis) ||
            string.IsNullOrEmpty(Prognosis) ||
            string.IsNullOrEmpty(Treatment))
        {
            throw new DataValidationException("Todos los campos son requeridos para el registro.");
        }*/

            //ConsultationDataAccess data = new ConsultationDataAccess();

            Consultation newConsultation = new Consultation
            {
                PatientId = patientId,
                DoctorId = doctorId,
                AppointmentId = appointmentId,

                FamilyHistory = familyHistory,
                FamilyHistoryDetails = familyHistoryDetails,
                PastMedicalHistory = pastMedicalHistory,
                PastMedicalHistoryDetails = pastMedicalHistoryDetails,
                PersonalHistory = personalHistory,
                PersonalHistoryDetails = personalHistoryDetails,

                HeartRate = heartRate,
                BloodPressure = bloodPressure,
                RespirationRate = respirationRate,
                Temperature = temperature,
                CurrentWeight = currentWeight,
                Height = height,
                IdealWeight = idealWeight,

                ChiefComplaints = chiefComplaints,
                GeneralSymptoms = generalSymptoms,

                CurrentCondition = currentCondition,
                CurrentConditionDetails = currentConditionDetails,
                PreviousDiagnoses = previousDiagnoses,
                PreviouslyEmployedTherapeutic = previouslyEmployedTherapeutic,

                DigestiveApparatus = digestiveApparatus,
                CardiovascularApparatus = cardiovascularApparatus,
                RespiratoryApparatus = respiratoryApparatus,
                UrinaryApparatus = urinaryApparatus,
                GenitalApparatus = genitalApparatus,
                HematologicApparatus = hematologicApparatus,
                EndocrineSystem = endocrineSystem,
                MusculoskeletalSystem = musculoskeletalSystem,
                NervousSystem = nervousSystem,
                SensorialSystem = sensorialSystem,
                Psychosomatic = psychosomatic,

                GeneralExamination = generalExamination,
                ExaminationHead = examinationHead,
                ExaminationNeck = examinationNeck,
                ExaminationChest = examinationChest,
                ExaminationAbdomen = examinationAbdomen,
                ExaminationMembers = examinationMembers,
                ExaminationGenitals = examinationGenitals,


                /*AppointmentId = AppointmentId,
                ConsultationDate = ConsultationDate,
                ConsultationStatus = ConsultationStatus,
                ChiefComplaints = ChiefComplaints,
                GeneralSymptoms = GeneralSymptoms,*/
                Comments = comments,
                Diagnosis = diagnosis,
                Prognosis = prognosis,
                Treatment = treatment
            };
            ConsultationDataAccess.InsertConsultation(newConsultation);
            return newConsultation;
        }

        public static ICollection<Consultation> SearchConsultation(string patientId)
        {
            return ConsultationDataAccess.SearchConsultation(patientId);
        }

        public static Consultation ShowConsultation(long idConsultation)
        {
            Consultation consultation = ConsultationDataAccess.ShowConsultation(idConsultation);
            return consultation;

        }

        public static Consultation ShowConsultationAppointment(long idConsultation)
        {
            Consultation consultation = ConsultationDataAccess.ShowConsultationAppointment(idConsultation);
            return consultation;

        }
    }
}
